//package org.wyw.utils;
//
//import javax.servlet.http.HttpServletRequest;
//
//public class IpTools {
//
//    public static String getIpAddr(HttpServletRequest request) {
//        String ip = request.getHeader("X-Real-IP");
//        if (ip == null || "".equals(ip.trim()) || "unknown".equalsIgnoreCase(ip)) {
//            ip = request.getHeader("X-Forwarded-For");
//        }
//        if (ip == null || "".equals(ip.trim()) || "unknown".equalsIgnoreCase(ip)) {
//            ip = request.getHeader("Proxy-Client-IP");
//        }
//        if (ip == null || "".equals(ip.trim()) || "unknown".equalsIgnoreCase(ip)) {
//            ip = request.getHeader("WL-Proxy-Client-IP");
//        }
//        if (ip == null || "".equals(ip.trim()) || "unknow".equalsIgnoreCase(ip)) {
//            ip = request.getHeader("HTTP_CLLENT_IP");
//        }
//        if (ip == null || "".equals(ip.trim()) || "unknow".equalsIgnoreCase(ip)) {
//            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
//        }
//        if (ip == null || "".equals(ip.trim()) || "unknown".equalsIgnoreCase(ip)) {
//            ip = request.getRemoteAddr();
//        }
//        if("0.0.0.0".equals(ip) || "0:0:0:0:0:0:0:1".equals(ip) || "localhost".equals(ip) || "127.0.0.1".equals(ip)){
//            ip = "127.0.0.1";
//        }
//        return ip;
//    }
//}
